NAND flash is a kind of flash memory. A NAND flash memory has such advantages as a large capacity and a high rewriting speed, and is applicable to mass data storage. Therefore, the NAND flash memory is increasingly used in the industry, for example, in an embedded product including a digital camera, a Moving Picture Experts Group Audio Layer III (MP3) player, a small-sized USB flash drive, and the like.
At present, NAND flash is often selected in a boot. Generally, only one piece of NAND flash is required to start a boot program. Because of a large capacity feature, a NAND flash may be adopted to start a program and store data, thereby reducing product costs.
A method for starting a boot program by using a NAND flash in the prior art mainly includes the following steps:
First read boot data; then use an Error Checking and Correction (ECC) algorithm to determine whether the boot data has an error; and if the boot data has an error, directly feed back a boot start failure, and the boot can start successfully when all the boot data is determined to be free of error by using the ECC algorithm.
However, in an implementation process of the present invention, all existing flash components are troubled by a bit switching phenomenon, and the NAND flash is no exception. That is, a problem of bit switching also exists in the NAND flash. For example, during use of the NAND flash, a certain bit of a storage unit may flip or may be reported to flip, resulting in a change to stored data. If the changed data is beyond a correction capacity of the ECC algorithm, it leads to a boot program start failure.
In addition, a problem of randomly-distributed bad blocks exists when a NAND flash component is delivered out of a factory. A bad block is a physical block that cannot be used. Likewise, during use of a NAND flash, a problem of a bad block may also randomly occur. A bad block randomly occurring to the NAND flash may also lead to a data error, so as to cause a boot program start failure.